package com.example.project_01.controller;

import com.example.project_01.commons.Result;
import com.example.project_01.service.FileUploadService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/fileUpload")
@CrossOrigin
@Tag(name = "图片文件上传", description = "这个接口是图片文件上传的接口")
public class FileUploadController {

    @Autowired
    FileUploadService fileUploadService;

    //文件上传
    //@RolesAllowed({"1","2"})   //指定访问的角色
    @PostMapping("/uploadFile")
    public Result uploadFile(@RequestParam("file") MultipartFile file) {
        return fileUploadService.uploadImg(file);
    }

}
